<?php

	require_once ("application/controller/Application.php");
	require_once ("common/view/PageView.php");
	require_once ("common/view/DebugView.php");

	session_start();

	\Debug::log("session started ");

	$app = new \application\controller\Application();
	$pageView = new \common\view\PageView();
	$debug = new \common\view\DebugView();
	$account = new application\model\JBAccount();
	$myMessage = array();

	if (isset($_GET["newAccount"]) || isset($_GET["create_account"]))
	{

		
		$myTempName = "";

		if (isset($_GET["create_account"]))
		{

			$myAccount = $account->createMyAccount();
			$myMessage = $account->getMyMessage();
			$myTempName = $account->getMyTempName();
			$okUser = $account->isUserLoggedIn();

		}
		
		$okUser = $account->isUserLoggedIn();
		if($okUser==true)
		{
			
			$page = $app->doFrontPage($myMessage);
			
		}
		if($okUser==false)
		{
			
			$page = $app->doCreateAccountPage($myMessage, $myTempName);
			
		}
		
		
	}
	else
	{
		$page = $app->doFrontPage($myMessage);
	}

	$debugDump = $debug->getDebugData();

	$page->body .= $debugDump;

	echo $pageView->GetXHTML10StrictPage($page);
